// 全局过滤器
const filters = [
  function phoneFilter(phone) {
    if (!phone) return
    return String(phone).replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
  },
  function fullAdress(address) {
    const { provinceName, cityName, areaName, detail } = address
    return `${provinceName}、${cityName}、${areaName} ${detail}`
  },
  function expressSnFilter(expressSn) {
    if (!expressSn) return
    return String(expressSn).replace(/^(\d{3})\d+(\d{4})$/, '$1********$2')
  }
]

export default app => {
  for (const filter of filters) {
    app.filter(filter.name, filter)
  }
}
